package com.jsgt.greekfire.ui.mine.user.backupwalletword.adapter

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import com.fhx.core.base.BaseAdapter
import com.fhx.core.base.BaseViewHolder
import com.jsgt.greekfire.R

/**
 * 助记词适配器
 */
class WordHelperAdapter : BaseAdapter<String>() {

    inner class VH(itemView: View) : BaseViewHolder(itemView) {
        private var wordTv: TextView? = null
        private var indexTv: TextView? = null

        init {
            wordTv = itemView.findViewById(R.id.word_tv)
            indexTv = itemView.findViewById(R.id.index_tv)
        }

        fun bindData(word: String, position: Int) {
            indexTv?.text = "${position + 1}"
            wordTv?.text = word
        }
    }

    override fun provideViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder? {
        val view =
            LayoutInflater.from(parent.context).inflate(R.layout.item_help_word, parent, false)
        return VH(view)
    }
    override fun onBindViewHolder(holder: BaseViewHolder, position: Int) {
        val viewHolder = holder as VH
        viewHolder.bindData(dataList()[position], position)
    }
}